Attribute VB_Name = "AnsHdrV1"
'
'
'
'ANS SPECTRUM FILE FORMATS
'
'
'OxfordWIN-MCA and ASSAYER software stores spectrum data in files with
'the .ANS extension.  These files contain all of the information about the
'file, how and when the data was taken, calibrations, spectral data and ROIs.
'The file format consists of a 1024 byte header structure, an optional data
'block (not used by current software), data stored as 32 bit signed integers,
'and a variable length ROI description table.
'
'Prior to v3.8 there have been two versions of the header.  These are
'revisions 0 and 1.  The header revision is contained in the first word of
'the header. See other files for revisions 2 and later.
'
'The following information is useful in interpreting the data in the header.
'
Type MaterialStruct                 '34 bytes
    MtlKey As Integer       '        Index to database entry
    MtlName As String * 10  '        Name of material in database
    z1 As Integer           ' Atomic number of each constituent
    z2 As Integer           ' Atomic number of each constituent
    z3 As Integer           ' Atomic number of each constituent
    f1 As Single            ' Weight percent of each constituent
    f2 As Single            ' Weight percent of each constituent
    f3 As Single            ' Weight percent of each constituent
    Density As Single       '        Material Density
End Type
'
'Header Section
'
'The header format for revision 1 is defined below.  All fields are
'identical to earlier versions unless marked with ##REV1.
'
Type anshead1
    rev As Integer                  '[000-001]  Revision Code (1)
    '--- General Information
    file As String * 12             '[002-013]  Short file name 12 bytes maximum
    id As String * 72               '[014-085]  Spectrum id
    StartDate As Double             '[086-093]  Time in Windows Format Acq First Started
    StopDate As Double              '[094-101]  Time in Windows format Acq Last Ended
    '--- Status Information
    ElapsedRT As Double             '[102-109]  Elapsed real time in sec: xxx.xx
    ElapsedLT As Double             '[110-117]  Elapsed live time in sec: xxx.xx
    ElapsedPass As Long             '[118-121]  Elapsed number of passes
    DeadTime As Single              '[122-125]  Incremental dead time
    '--- Hardware Setup - AMP
    AmpType As Integer              '[126-127]  Key to  DB Table "Amplifiers"
    AMPID As String * 12            '[128-139]  User provided ID for Amp
    AMPCoarseGain As Single         '[140-143]  Coarse Gain
    AMPFineGain As Single           '[144-147]  Fine Gain
    AMPPoleZero As Single           '[148-151]  Pole Zero
    AMPShapingTime As Single        '[152-155]  Shaping time constant in microseconds
    AMPPileUpRej As Integer         '[156-157]  Bool Pile Up Rejector enabled
    AMPPolarity As Integer          '[158-159]  Bool Input Polarity (0=Neg, 1=Pos)
    AMPFastThresh As Single         '[160-163]  Fast threshold setting (-100% to +100% )   ##REV1
    AMPShapingType As Integer       '[164-165]  0=External, 1=Biploar,                     ##REV1
                                    '           2=Unipolar Gaussian, 3=Gated Integrator    ##REV1
    AMPCTRL As Integer              '[166-167]  Bitwise control word specific to           ##REV1
                                    '           each amp type                              ##REV1
    '--- Hardware Setup - ADC
    ADCType As Integer              '[168-169]  Key to DB Table "ADCs"
    ADCID As String * 12            '[170-181]  User provided ID for ADC
    ADCZero As Single               '[182-185]  ADC Zero Adjust
    ADCLLD As Single                '[186-189]  Low Level Discriminator
    ADCULD As Single                '[190-193]  Upper Level Discriminator
    ADCConvGain As Integer          '[194-195]  256, 512, ... 8192...(max 16384)
    ADCGroupSz As Integer           '[196-197]  256, 512, ... 8192...(max 16384)
    ADCGroup As Integer             '[198-199]  Current Group
    ADCOffset As Integer            '[200-201]  ADC Digital Offset
    ADCGate As Integer              '[202-203]  Gate Mode
    ADCDTMode As Integer            '[204-205]  Dead Time Mode
    ADCGSOn As Integer              '[206-207]  Gain Stabilizer Active
    ADCGSRange As Integer           '[208-209]  Gain Range of Correction
    ADCGSOffset As Integer          '[210-211]  Gain Current Value of correction
    ADCGSROIStart As Integer        '[212-213]  Gain Stab start region
    ADCGSROIEnd As Integer          '[214-215]  Gain Stab end region
    ADCGSROI As Integer             '[216-217]  ROI associated with gain stabilization
    ADCZSOn As Integer              '[218-219]  Zero Stabilizer Active
    ADCZSRange As Integer           '[220-221]  Zero Range of Correction
    ADCZSOffset As Integer          '[222-223]  Zero Current Value of correction
    ADCZSROIStart As Integer        '[224-225]  Zero Stab start region
    ADCZSROIEnd As Integer          '[226-227]  Zero Stab end region
    ADCZSROI As Integer             '[228-229]  ROI associated with zero stabilization
    ADCMode As Integer              '[230-231]  Operating Mode 0=MCS,1=PHA,2=??,3=SVAH, 4=SVAL
    ADCConvMode As Integer          '[232-233]  Type of conversion QCC, Linear, etc
    ADCPileUp As Integer            '[234-235]  Bool Pile Up Rejector Enable
    ADCDwellTime As Single          '[236-239]  Dwell time (need to decide on units)
    ADCPasses As Long               '[240-243]  Number of passes for MCS
    ADCSampInterval As Single       '[244-247]  Sample Interval
    ADCSyncMode As Integer          '[248-249]  SyncMode (0=Internal, 1=External)
    ADCCtrlWord As Integer          '[250-251]  Special Control Word unique for each ADC type
    '--- Hardware Setup - Bias
    BiasOn As Integer               '[252-253]  On/Off
    BiasType As Integer             '[254-255]  Key to DB Table "Bias"
    BiasID As String * 12           '[256-267]  User Supplied ID
    BiasSetPt As Single             '[268-271]  Set Point for Bias Supply
    BiasVoltage As Single           '[272-275]  Voltage Setting
    BiasCurrentLimit As Single      '[276-279]  Current Limit in ma
    BiasCtrl As Integer             '[280-281]  HV Bias Control word
    '--- Energy Calibration Data
    EnCalFlag As Integer            '[282-283]  Flag for valid energy calibration
    EnCalKey As Long                '[284-287]  Pointer to Calibration data in database
    EnCalType As Integer            '[288-289]  Type of energy calibration (0 = linear, 1 = sqrt)
    EnCal0 As Single         '[290-305]  Calibration constants
    EnCal1 As Single         '[290-305]  Calibration constants
    EnCal2 As Single         '[290-305]  Calibration constants
    EnCal3 As Single         '[290-305]  Calibration constants
    EnCalUnits As String * 4        '[306-309]  X axis calibration units
    EnergyShift As Single           '[310-313]  Amount this spectrum is shifted from the nominal
                                    '           energy calibration
    '--- Shape Calibration Data
    ShCalFlag As Integer            '[314-315]  Flag for valid shape calibration
    ShCalKey As Long                '[316-319]  Pointer to Calibration data in database
    ShCalType As Integer            '[320-321]  Type of equation represented
    ShCal0 As Single         '[322-337]  Calibration constants
    ShCal1 As Single         '[322-337]  Calibration constants
    ShCal2 As Single         '[322-337]  Calibration constants
    ShCal3 As Single         '[322-337]  Calibration constants
    '--- Efficiency Calibration data
    EfCalFlag As Integer            '[338-339]  Flag for valid efficiency calibration
    EfCalKey As Long                '[340-343]  Pointer to Calibration data in database
    EfCalType As Integer            '[344-345]  Type of equation represented
    EfCal0 As Single         '[346-381]  Calibration constants
    EfCal1 As Single         '[346-381]  Calibration constants
    EfCal2 As Single         '[346-381]  Calibration constants
    EfCal3 As Single         '[346-381]  Calibration constants
    EfCal4 As Single         '[346-381]  Calibration constants
    EfCal5 As Single         '[346-381]  Calibration constants
    EfCal6 As Single         '[346-381]  Calibration constants
    EfCal7 As Single         '[346-381]  Calibration constants
    EfCal8 As Single         '[346-381]  Calibration constants
    EfCalUnc As Single              '[382-385]  Uncertainty in calibration                ###REV1
    '--- Detector
    DETType As Integer              '[386-387]  Detector Type, ie, 0=NaI, 1=SiLi, 2=HpGe(P), ...
    DetKey As Long                  '[388-391]  Link to Detectors Database
    DetID As String * 12            '[392-403]  Detector Name
    DetShape As Integer             '[404-405]  Detector shape, 0 =
    DetThickness As Single          '[406-409]  Thickness of detector
    DetDiameter As Single           '[410-413]  Diameter of detector
    DetWellDia As Single            '[414-417]  Diameter of well
    DetWellDepth As Single          '[418-421]  Depth of well
    DetSourceDist As Single         '[422-425]  source to detector distance
    DetTakeOffAng As Single         '[426-429]  takeoff angle from detector 0 = normal
    DetWinThick0 As Single   '[430-445]  thickness of each possible detector window
    DetWinThick1 As Single   '[430-445]  thickness of each possible detector window
    DetWinThick2 As Single   '[430-445]  thickness of each possible detector window
    DetWinThick3 As Single   '[430-445]  thickness of each possible detector window
    DetMtl0 As MaterialStruct '[446-581]  Detector window Materials structures
    DetMtl1 As MaterialStruct '[446-581]  Detector window Materials structures
    DetMtl2 As MaterialStruct '[446-581]  Detector window Materials structures
    DetMtl3 As MaterialStruct '[446-581]  Detector window Materials structures
    DetAxisElev As Single           '[582-585]  Detector axis angle (microanalysis)        ##REV1
    DetAzimuth As Single            '[586-589]  Detector Azimuth angle (microanalysis)     ##REV1
    DetElevation As Single          '[590-593]  Detector elevation angle (microanalysis)   ##REV1
    '--- Hardware on which spectrum was taken
    OLDDevName As String * 8        '[594-601]  Replaced by longer name in ver 1           ##REV1
    DevType As Integer              '[602-603]  Numeric ID of Device Type:
    DevAddr As Integer              '[604-605]  Buss address of device
    DevUnit As Integer              '[606-607]  Unit number: (0-7) for P&3, (IEEE addr 1-16)
    DevID As Integer                '[608-609]  Pointer record in SPECD.PRM
    DevCaps As Integer              '[610-611]  Device capabilities
    DevStatus As Integer            '[612-613]  Device Status
    hPORT As Integer                '[614-615]  Port handle
                                    '            (not valid from one session to another)
    hdev As Integer                 '[616-617]  Device handle
                                    '            (not valid from one session to another)
    '--- Hardware Setup - Presets
    PresetON As Integer             '[618-619]  Presets are on if true
    PresetRT As Long                '[620-623]  Real Time Preset
    PresetLT As Long                '[624-627]  Live Time Preset
    PresetPK As Long                '[628-631]  Peak Preset
    PresetIT As Long                '[632-635]  Integral Presets
    PresetITROI As Integer          '[636-637]  ROI which is to serve for preset ROI
    '---Tool Settings
    PKmode As Integer               '[638-639]  find peaks convolution type
    PKpwr As Integer                '[640-641]  find peaks convolution avg threshold
    PKintg As Integer               '[642-643]  find peaks convolution integral threshold
    BKGwidth As Integer             '[644-645]  find peaks bkg width
    BKGspread As Single             '[646-649]  find peaks bkg gap as multiplier of FWHM
    ROIwidth As Single              '[650-653]  find peaks ROI width as multiple of FWHM
    EMatchMode As Integer           '[654-655]  0 = a * FWHM, b = a + b*E
    EwinA As Single                 '[656-659]  a
    EwinB As Single                 '[660-663]  b
    AppType As Integer              '[664-665]  Spectroscopy type being performed
    '--- Background Model Data
    BkgModelFlag As Integer         '[666-667]  Flag for valid shape calibration          ##REV1
    BkgModelKey As Long             '[668-671]  Pointer to Calibration data in database   ##REV1
    BkgModelType As Integer         '[672-673]  Type of equation represented              ##REV1
    BkgModel0 As Single      '[674-689]  Calibration constants                     ##REV1
    BkgModel1 As Single      '[674-689]  Calibration constants                     ##REV1
    BkgModel2 As Single      '[674-689]  Calibration constants                     ##REV1
    BkgModel3 As Single      '[674-689]  Calibration constants                     ##REV1

    '--- Microanalysis parameters
    SampleKey As Long               '[690-693]  Link to Sample Database (microanalysis)   ##REV1
    SampXtilt As Single             '[694-697]  Sample X-tilt (microanalysis)             ##REV1
    WorkDist As Single              '[698-701]  Sample working distance (microanalysis)   ##REV1
    Exctype As Integer              '[702-703]  Type of excitation (microanalysis)        ##REV1
    ExcEnergy As Single             '[704-707]  Energy of excitation keV (microanalysis)  ##REV1
    ExcNuc As String * 6            '[708-713]  Exciting Isotope or element               ##REV1
    ExcCurrent As Single            '[714-717]  Excitation Beam Current                   ##REV1
    ExcAngle As Single              '[718-721]  Angle of excitation beam                  ##REV1
    DetHeight As Single             '[722-725]  Height of detector above sample           ##REV1
    DetInsertDepth As Single        '[726-729]  Detector insertion depth                  ##REV1
    DetXtlAngle As Single           '[730-733]                                            ##REV1
    SampDetAngle As Single          '[734-737]  angle between sample normal and           ##REV1
                                    '            vector to detector
    '--- Oxford PCAX Parameters
    PCAXDACA As Single              '[738-741]  0 to 10.0 V range for DAC A
    PCAXDACB As Single              '[742-745]  0 to 10.0 V range for DAC B
    PCAXSampChange As Integer       '[746-747]  State of Sample Change Line
    '--- Sample Information
    SampQuantity As Single          '[748-751]  Amount of sample in user specified units   ##REV1
    SampQuantUnc As Single          '[752-755]  Uncertainty in amount of sample            ##REV1
    SampUnits As String * 4         '[756-759]  User specified units for sample quantity   ##REV1
    SampActivDate As Double         '[760-767]  Date to report activity as of              ##REV1
    '--- More Tools Setup
    PKminengy As Single             '[768-771]  Low energy cutoff for peak search          ##REV1
    PKmaxuncer As Single            '[772-775]  Acceptable statistical uncertainty         ##REV1
    EnFullScale As Integer          '[776-777]  Full scale energy of calib in keV          ##REV1
    MDAKa As Single                '[778-781]  Ka for MDA calculation                     ##REV1
    MDAKb As Single                '[782-785]  Kb for MDA calculation                     ##REV1
    BKGROIRange As Integer         '[786-787]  Manual background ROI capture range (chans)##REV1
    '--- Reserved space
    Reserved1 As String * 210       '[788-997]  Reserved space
    DevName As String * 16          '[998-1013] Long Device name                          ##REV1
    '--- Data to describe additional sections of file
    SpecStart As Integer            '[1014-1015]  First channel in file
    SpecEnd As Integer              '[1016-1017]  Last Channel in file
    NROIs As Integer                '[1018-1019]  Number of ROIStructs in file
    AcqSysType As Integer           '[1020-1021]  System type designator
    AcqSysLen As Integer            '[1022-1023]  Length of Parameter block following header
End Type
'
'The header format for revision 0 is defined below:
'
Type anshead0
    rev As Integer                  '[000-001]  Revision Code (0)
    '--- General Information
    file As String * 12             '[002-013]  Short file name 12 bytes maximum
    id As String * 72               '[014-085]  Spectrum id
    StartDate As Double             '[086-093]  Time in Windows Format Acq First Started
    StopDate As Double              '[094-101]  Time in Windows format Acq Last Ended
    '--- Status Information
    ElapsedRT As Double             '[102-109]  Elapsed real time in sec: xxx.xx
    ElapsedLT As Double             '[110-117]  Elapsed live time in sec: xxx.xx
    ElapsedPass As Long             '[118-121]  Elapsed number of passes
    DeadTime As Single              '[122-125]  Incremental dead time
    '--- Hardware Setup - AMP
    AmpType As Integer              '[126-127]  Key to  DB Table "Amplifiers"
    AMPID As String * 12            '[128-139]  User provided ID for Amp
    AMPCoarseGain As Single         '[140-143]  Coarse Gain
    AMPFineGain As Single           '[144-147]  Fine Gain
    AMPPoleZero As Single           '[148-151]  Pole Zero
    AMPShapingTime As Single        '[152-155]  Shaping time constant in microseconds
    AMPPileUpRej As Integer         '[156-157]  Bool Pile Up Rejector enabled
    AMPPolarity As Integer          '[158-159]  Bool Input Polarity (0=Neg, 1=Pos)
    AMPInputMode As Integer         '[160-161]  Bool Input Mode (0=Sing Ended, 1=Differ)   ##REV1
    AMPUnipolar As Integer          '[162-163]  Bool Output Mode (0=Unipolar, 1=Bipolar)   ##REV1
    AMPShapingType As Integer       '[164-165]  0=External, 1=Biploar,
                                    '           2=Unipolar Gaussian, 3=Gated Integrator
    AMPBDC As Integer               '[166-167]  Unused                                     ##REV1
'--- Hardware Setup - ADC
    ADCType As Integer              '[168-169]  Key to DB Table "ADCs"
    ADCID As String * 12            '[170-181]  User provided ID for ADC
    ADCZero As Single               '[182-185]  ADC Zero Adjust
    ADCLLD As Single                '[186-189]  Low Level Discriminator
    ADCULD As Single                '[190-193]  Upper Level Discriminator
    ADCConvGain As Integer          '[194-195]  256, 512, ... 8192...(max 16384)
    ADCGroupSz As Integer           '[196-197]  256, 512, ... 8192...(max 16384)
    ADCGroup As Integer             '[198-199]  Current Group
    ADCOffset As Integer            '[200-201]  ADC Digital Offset
    ADCGate As Integer              '[202-203]  Gate Mode
    ADCDTMode As Integer            '[204-205]  Dead Time Mode
    ADCGSOn As Integer              '[206-207]  Gain Stabilizer Active
    ADCGSRange As Integer           '[208-209]  Gain Range of Correction
    ADCGSOffset As Integer          '[210-211]  Gain Current Value of correction
    ADCGSROIStart As Integer        '[212-213]  Gain Stab start region
    ADCGSROIEnd As Integer          '[214-215]  Gain Stab end region
    ADCGSROI As Integer             '[216-217]  ROI associated with gain stabilization
    ADCZSOn As Integer              '[218-219]  Zero Stabilizer Active
    ADCZSRange As Integer           '[220-221]  Zero Range of Correction
    ADCZSOffset As Integer          '[222-223]  Zero Current Value of correction
    ADCZSROIStart As Integer        '[224-225]  Zero Stab start region
    ADCZSROIEnd As Integer          '[226-227]  Zero Stab end region
    ADCZSROI As Integer             '[228-229]  ROI associated with zero stabilization
    ADCMode As Integer              '[230-231]  Operating Mode 0=MCS,1=PHA,2=??,3=SVAH, 4=SVAL
    ADCConvMode As Integer          '[232-233]  Type of conversion QCC, Linear, etc
    ADCPileUp As Integer            '[234-235]  Bool Pile Up Rejector Enable
    ADCDwellTime As Single          '[236-239]  Dwell time (need to decide on units)
    ADCPasses As Long               '[240-243]  Number of passes for MCS
    ADCSampInterval As Single       '[244-247]  Sample Interval
    ADCSyncMode As Integer          '[248-249]  SyncMode (0=Internal, 1=External)
    ADCCtrlWord As Integer          '[250-251]  Special Control Word unique for each ADC type
    '--- Hardware Setup - Bias
    BiasOn As Integer               '[252-253]  On/Off
    BiasType As Integer             '[254-255]  Key to DB Table "Bias"
    BiasID As String * 12           '[256-267]  User Supplied ID
    BiasSetPt As Single             '[268-271]  Set Point for Bias Supply
    BiasVoltage As Single           '[272-275]  Voltage Setting
    BiasCurrentLimit As Single      '[276-279]  Current Limit in ma
    BiasCtrl As Integer             '[280-281]  HV Bias Control word
    '--- Energy Calibration Data
    EnCalFlag As Integer            '[282-283]  Flag for valid energy calibration
    EnCalKey As Long                '[284-287]  Pointer to Calibration data in database
    EnCalType As Integer            '[288-289]  Type of energy calibration (0 = linear, 1 = sqrt)
    EnCal0 As Single         '[290-305]  Calibration constants
    EnCal1 As Single         '[290-305]  Calibration constants
    EnCal2 As Single         '[290-305]  Calibration constants
    EnCal3 As Single         '[290-305]  Calibration constants
    EnCalUnits As String * 4        '[306-309]  X axis calibration units
    EnergyShift As Single           '[310-313]  Amount this spectrum is shifted from the nominal
                                    '            energy calibration
    '--- Shape Calibration Data
    ShCalFlag As Integer            '[314-315]  Flag for valid shape calibration
    ShCalKey As Long                '[316-319]  Pointer to Calibration data in database
    ShCalType As Integer            '[320-321]  Type of equation represented
    ShCal0 As Single         '[322-337]  Calibration constants
    ShCal1 As Single         '[322-337]  Calibration constants
    ShCal2 As Single         '[322-337]  Calibration constants
    ShCal3 As Single         '[322-337]  Calibration constants
    '--- Efficiency Calibration data
    EfCalFlag As Integer            '[338-339]  Flag for valid efficiency calibration
    EfCalKey As Long                '[340-343]  Pointer to Calibration data in database
    EfCalType As Integer            '[344-345]  Type of equation represented
    EfCal0 As Single         '[346-381]  Calibration constants
    EfCal1 As Single         '[346-381]  Calibration constants
    EfCal2 As Single         '[346-381]  Calibration constants
    EfCal3 As Single         '[346-381]  Calibration constants
    EfCal4 As Single         '[346-381]  Calibration constants
    EfCal5 As Single         '[346-381]  Calibration constants
    EfCal6 As Single         '[346-381]  Calibration constants
    EfCal7 As Single         '[346-381]  Calibration constants
    EfCal8 As Single         '[346-381]  Calibration constants
    EfCalTrans As Single            '[382-385]  Transition point
    '--- Detector
    DETType As Integer              '[386-387]  Detector Type, ie, 0=NaI, 1=SiLi, 2=HpGe(P), ...
    DetKey As Long                  '[388-391]  Link to Detectors Database
    DetID As String * 12            '[392-403]  Detector Name
    DetShape As Integer             '[404-405]  Detector shape, 0 =
    DetThickness As Single          '[406-409]  Thickness of detector
    DetDiameter As Single           '[410-413]  Diameter of detector
    DetWellDia As Single            '[414-417]  Diameter of well
    DetWellDepth As Single          '[418-421]  Depth of well
    DetSourceDist As Single         '[422-425]  source to detector distance
    DetTakeOffAng As Single         '[426-429]  takeoff angle from detector 0 = normal
    DetWinThick0 As Single   '[430-445]  thickness of each possible detector window
    DetWinThick1 As Single   '[430-445]  thickness of each possible detector window
    DetWinThick2 As Single   '[430-445]  thickness of each possible detector window
    DetWinThick3 As Single   '[430-445]  thickness of each possible detector window
    DetMtl0 As MaterialStruct '[446-581]  Detector window Materials structures
    DetMtl1 As MaterialStruct '[446-581]  Detector window Materials structures
    DetMtl2 As MaterialStruct '[446-581]  Detector window Materials structures
    DetMtl3 As MaterialStruct '[446-581]  Detector window Materials structures
    DetChiRho As Single             '[582-585]  Detector chirho (microanalysis)            ##REV1
    DetAzimuth As Single            '[586-589]  Detector Azimuth angle (microanalysis)
    DetElevation As Single          '[590-593]  Detector elevation angle (microanalysis)
    '--- Hardware on which spectrum was taken
    DevName As String * 8           '[594-601]  ASCII name of device, ie PCAP              ##REV1
    DevType As Integer              '[602-603]  Numeric ID of Device Type:
    DevAddr As Integer              '[604-605]  Buss address of device
    DevUnit As Integer              '[606-607]  Unit number: (0-7) for P&3, (IEEE addr 1-16)
    DevID As Integer                '[608-609]  Pointer record in SPECD.PRM
    DevCaps As Integer              '[610-611]  Device capabilities
    DevStatus As Integer            '[612-613]  Device Status
    hPORT As Integer                '[614-615]  Port handle
                                    '            (not valid from one session to another)
    hdev As Integer                 '[616-617]  Device handle
                                    '            (not valid from one session to another)
    '--- Hardware Setup - Presets
    PresetON As Integer             '[618-619]  Presets are on if true
    PresetRT As Long                '[620-623]  Real Time Preset
    PresetLT As Long                '[624-627]  Live Time Preset
    PresetPK As Long                '[628-631]  Peak Preset
    PresetIT As Long                '[632-635]  Integral Presets
    PresetITROI As Integer          '[636-637]  ROI which is to serve for preset ROI
    '---Tool Settings
    PKmode As Integer               '[638-639]  find peaks convolution type
    PKpwr As Integer                '[640-641]  find peaks convolution avg threshold
    PKintg As Integer               '[642-643]  find peaks convolution integral threshold
    BKGwidth As Integer             '[644-645]  find peaks bkg width
    BKGspread As Single             '[646-649]  find peaks bkg gap as multiplier of FWHM
    ROIwidth As Single              '[650-653]  find peaks ROI width as multiple of FWHM
    EMatchMode As Integer           '[654-655]  0 = a * FWHM, b = a + b*E
    EwinA As Single                 '[656-659]  a
    EwinB As Single                 '[660-663]  b
    AppType As Integer              '[664-665]  Spectroscopy type being performed
    '--- Background Model Data
    BkgModelFlag As Integer         '[666-667]  Flag for valid shape calibration
    BkgModelKey As Long             '[668-671]  Pointer to Calibration data in database
    BkgModelType As Integer         '[672-673]  Type of equation represented
    BkgModel0 As Single      '[674-689]  Calibration constants
    BkgModel1 As Single      '[674-689]  Calibration constants
    BkgModel2 As Single      '[674-689]  Calibration constants
    BkgModel3 As Single      '[674-689]  Calibration constants

    '--- Microanalysis parameters
    SampleKey As Long               '[690-693]  Link to Sample Database (microanalysis)   ##REV1
    SampXtilt As Single             '[694-697]  Sample X-tilt (microanalysis)             ##REV1
    WorkDist As Single              '[698-701]  Sample working distance (microanalysis)   ##REV1
    Exctype As Integer              '[702-703]  Type of excitation (microanalysis)        ##REV1
    ExcEnergy As Single             '[704-707]  Energy of excitation keV (microanalysis)  ##REV1
    ExcNuc As String * 6            '[708-713]  Exciting Isotope or element               ##REV1
    ExcCurrent As Single            '[714-717]  Excitation Beam Current                   ##REV1
    ExcAngle As Single              '[718-721]  Angle of excitation beam                  ##REV1
    DetHeight As Single             '[722-725]  Height of detector above sample           ##REV1
    DetInsertDepth As Single        '[726-729]  Detector insertion depth                  ##REV1
    DetXtlAngle As Single           '[730-733]                                            ##REV1
    SampDetAngle As Single          '[734-737]  angle between sample normal and           ##REV1
                                    '            vector to detector
    '--- Oxford PCAX Parameters
    PCAXDACA As Single              '[738-741]  0 to 10.0 V range for DAC A
    PCAXDACB As Single              '[742-745]  0 to 10.0 V range for DAC B
    PCAXSampChange As Integer       '[746-747]  State of Sample Change Line
    '--- Reserved space
    Reserved1 As String * 250       '[748-997]  Reserved space
    DevName2 As String * 16          '[998-1013] Long Device name                          ##REV1
    '--- Data to describe additional sections of file
    SpecStart As Integer            '[1014-1015]  First channel in file
    SpecEnd As Integer              '[1016-1017]  Last Channel in file
    NROIs As Integer                '[1018-1019]  Number of ROIStructs in file
    AcqSysType As Integer           '[1020-1021]  System type designator
    AcqSysLen As Integer            '[1022-1023]  Length of Parameter block following header

'********end of File Header
End Type
'
'
'
'   Device Type Definitions used in DEVTYPE
'
'Global Const dtNONE = -1                'No Valid Device
'Global Const dtPCAP = 1                 'PCA-P Device
'Global Const dtPCAM = 2                 'PCA3 or PCAM Protocol Device
'Global Const dtPCA3 = 5                 'PCA-3 Device (aliased for compatibility)
'Global Const dtOASIS = 6                'OASIS
'Global Const dtNANO = 25                'nanoSPEC
'Global Const dtUFAST = 30               'microFAST cards
'Global Const dtSIERRA = 31              'Sierra cards
'Global Const dtQTMMCA = 100             'ANS MCA2000R, Explorer , MCA2000
'Global Const dtWTC2K = 101              'ANS MCA2000Q, WTC2000, Prospector
'
'
'Special Data Block
'
'If the AcqSysType entry in the header is non-zero an additional block of
'data will be expected immediately after the header.  This block will be
'AcqSysLen bytes long.  This feature is not currently used.  If a file is
'detected with these values non-zero the data is discarded.
'
'Data Section
'
'Data is written as signed long integers (32 bits0 for each channel.
'Not all data need be stored.  A spectrum of size ADCGroupSz will be
'created and zeroed.  Data will be read and the first datum stored in
'channel SpecStart .  Data will continue to be read through channel SpecEnd.
'Note that the data contains no ROI information.
'The full 32 bits (signed) is used to represent the data.
'
'ROI Section
'
'The NROIs entry in the header defines the number of ROI structures stored
'with the spectrum.  Each ROI is represented by a structure of the form:
'
Type ROIDat                         '50 bytes
    id As String * 12               'ROI name
    StrEnergy As Single             'ROI start energy
    EndEnergy As Single             'ROI end energy
    Nuclide As String * 8           'Nuclide Pointer
    Itype As Integer                 'Hardware Tag
    Integral As Double              'Gross Integral
    Centroid As Single              'Centroid
    Peak As Single                  'Peak location in ROI
    FWHM As Single                  'FWHM (w/ Cont BKG correction)
End Type
'
'When ROIs are read into the software the information is converted to the
'new QROI format and all information except start, end, name, nuclide and
'type is recomputed.
'
